<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch">

            <!--RAG Lab ID
            <el-form-item prop="ragLabId">
                <el-input v-model="queryParams.ragLabId" placeholder="Pls input ragLabId" clearable />
            </el-form-item>
-->
            <!--Standard ID-->
            <el-form-item prop="standardId">
                <el-input v-model="queryParams.standardId" placeholder="Pls input standardId" clearable />
            </el-form-item>

            <!--Status-->
            <el-form-item prop="status">
                <el-select v-model="queryParams.status" placeholder="Select Status" clearable>
                    <el-option v-for="dict in dict.type.llm_lab_result_status" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                </el-select>
            </el-form-item>

            <!--Match Level-->
            <el-form-item prop="matchLevel">
                <el-select v-model="queryParams.matchLevel" placeholder="Select Level" clearable>
                    <el-option v-for="dict in dict.type.ade_match_level" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">Search</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">Reset</el-button>
            </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['ade:raglabresult:export']">Export</el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>

        <el-table v-loading="loading" :data="raglabresultList">
            <el-table-column label="ID" width="60" align="center" prop="id" />
            <el-table-column label="RAG Lab" width="80" align="center" prop="ragLabId" />
            <el-table-column label="Standard" width="80" align="center" prop="standardId" />
            <el-table-column label="Standard Ades" min-width="200" align="left" prop="standardAdes"
                show-overflow-tooltip />
            <el-table-column label="Ades" align="left" min-width="200" prop="ades" show-overflow-tooltip />
            <el-table-column label="Match Level" align="center" prop="matchLevel" />
            <el-table-column label="TC(S)" width="100" align="center" prop="timeConsumed" />
            <el-table-column label="Knowledges" align="center" prop="knowledgeCount" />
            <el-table-column label="Avg SimScore" align="center" prop="avgSimscore" />
            <el-table-column label="Status" align="center" prop="status">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.llm_lab_result_status" :value="scope.row.status" />
                </template>
            </el-table-column>
            <el-table-column label="Remark" align="center" prop="remark" show-overflow-tooltip />


        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />
    </div>
</template>

<script>
import { listRaglabresult, getRaglabresult, delRaglabresult, addRaglabresult, updateRaglabresult } from "@/api/ade/raglabresult";

export default {
    name: "Raglabresult",
    dicts: ['llm_lab_result_status',
        'ade_match_level'],
    props: {
        id: {                //ADE RAG Lab ID
            type: Number,
            required: true
        }
    },
    data() {
        return {
            // 遮罩层
            loading: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // Ade Rag Lab Result表格数据
            raglabresultList: [],
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 12,
                ragLabId: null,
                standardId: null,
                ades: null,
                timeConsumed: null,
                avgSimscore: null,
                status: null,
                knowledgeCount: null,
                matchLevel: null
            },
        };
    },
    created() {
        this.getList();
    },
    methods: {
        /** 查询Ade Rag Lab Result列表 */
        getList() {
            this.loading = true;
            this.queryParams.ragLabId = this.id; // 使用传入的llmLabId
            listRaglabresult(this.queryParams).then(response => {
                this.raglabresultList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
        /** 导出按钮操作 */
        handleExport() {
            this.download('ade/raglabresult/export', {
                ...this.queryParams
            }, `raglabresult_${new Date().getTime()}.xlsx`)
        }
    }
};
</script>
